﻿<?=$this->load->view('include_header',null)?>
	<div id="top-panel">
		<div id="panel">
			<ul>
				<li class="current"><a href="<?=site_url('archive/idcard/'.$id)?>" class="report"><?=(empty($id))?"录入新":"编辑"?>客户基本信息</a></li>
				
			</ul>
		</div>
	</div>
	<div id="wrapper">
		<div id="content">
			<div id="box">
			<form id="form" method="POST" action="<?=site_url('archive/passport_update/'.$cateid)?>">
			<fieldset>
			<legend>护照 PASSPORT</legend>
			<label>类型 Type:</label><input type="text" name="passport_type" value="<?=@$info->passport_type?>" /> <br />
			<label>国家码 Country Code:</label><input type="text" name="country_code" value="<?=@$info->country_code?>" /> <br />
			<label>护照号 Passport No.:</label><input type="text" name="passport_no" value="<?=@$info->passport_no?>" /> <br />
			<hr />
			<label>姓 Surnames:</label><input type="text" name="surname" value="<?=@$info->surname?>" /> <br />
			<label>名 Given names:</label><input type="text" name="firstname" value="<?=@$info->firstname?>" /> <br />
			<label>性别 Sex:</label><input type="radio" name="sex" value="1" <?= (@$info->sex==1)?'checked':''?> />男 / Male  <input type="radio" name="sex" value="2" <?= (@$info->sex==2)?'checked':''?> />女 / Female <br />
			<label>身份证号码 National Identification No.:</label><input type="text" name="idcard" value="<?=@$info->idcard?>" style="width:200px"/> <br />
			
			<label>出生日期 Date of Birth:</label><input type="text" name="birth" id="birth" value="<?=@$info->birth?>" /> <br />
			<label>出生地点 Place of birth:</label><input type="text" name="place" id="place" value="<?=@$info->place?>" style="width:200px; background: #FFFFC0;"/> <br />
			<label>签发地点 Place of issue:</label><input type="text" name="issue_place" id="issue_place" value="<?=@$info->issue_place?>" style="width:200px; background: #FFFFC0;"/> <br />
			<label>签发日期 Date of issue:</label><input type="text" name="issue_date" id="issue_date" value="<?=@$info->issue_date?>"/> <br />
			<label>有效期至 Date of expiry:</label><input type="text" name="issue_expiry" id="issue_expiry" value="<?=@$info->issue_expiry?>"/> <br />
			
			<input type="hidden" name="id" value="<?=$id?>" />
			<input id="button1" type="submit" value="提交信息 Continue" onclick="return check_date_rules()"/>
			<input id="button2" type="reset" value="重置 Cancel" />
			</fieldset>
			</form>
			</div>

		</div>
        
		<script type="text/javascript" src="js/jquery.autocomplete.pack.js"></script>
        <link type="text/css" rel="stylesheet" href="css/jquery.autocomplete.css"/>
        
		<?=$this->load->view('include_sidebar',array('id'=>$id,'forms'=>$forms))?>
	</div>

	<script type="text/javascript">
    function check_date_rules() {
        if(convert_to_date($('#birth').val()).getTime() >  new Date().getTime()) {
            alert('[出生日期]不能大于[当前日期]！');
            return false;
        }   
        if(convert_to_date($('#issue_date').val()).getTime() > new Date().getTime()) {
            alert('[签发日期]不能大于[当前日期]！'); 
            return false;
        }        
        if(convert_to_date($('#issue_date').val()).getTime() > convert_to_date($('#issue_expiry').val()).getTime()) {
            alert('[签发日期]不能大于[有效期至]！');
            return false;
        }           
        return true; 
    }
      
	$().ready(function() {
	  $("#form").validate({
		rules: {
			passport_no:{
			 required:true
			},
			sex:{
			 required:true
			},
			birth:{
			 required:true
			},
			issue_date:{
			 required:true
			},
			issue_expiry:{
			 required:true
			}
		}
	  });
	  
		$.datepicker.setDefaults(
			{
			dateFormat: 'dd/mm/yy',
			changeMonth: true,
			changeYear: true,
			showOn: "both",
			buttonImage: "images/calendar.gif",
			buttonImageOnly: true
			}
		);
		
		$("#birth").datepicker();
		$("#issue_date").datepicker();
		$("#issue_expiry").datepicker();

                
        $("#place").autocomplete("<?=base_url()?>user/quick_search_province", {
            minChars: 0,
            width: 500,
            matchContains: "word",
            autoFill: false,
            formatItem: function(row, i, max) {
                var arr = (row+"").split(",");
                return i + "/" + max + ": " + arr[1] + '['+ arr[2] +']';
            },
            formatMatch: function(row, i, max) {
                return row;
            },
            formatResult: function(row) {
                var arr = (row+"").split(",");
                return arr[2];
            }
        }); 
        
        $("#issue_place").autocomplete("<?=base_url()?>user/quick_search_province", {
            minChars: 0,
            width: 500,
            matchContains: "word",
            autoFill: false,
            formatItem: function(row, i, max) {
                var arr = (row+"").split(",");
                return i + "/" + max + ": " + arr[1] + '['+ arr[2] +']';
            },
            formatMatch: function(row, i, max) {
                return row;
            },
            formatResult: function(row) {
                var arr = (row+"").split(",");
                return arr[2];
            }
        });
        
	});
	</script>
	
<?=$this->load->view('include_footer',null)?>
